/* -*- Mode: C++; c-basic-offset: 4; -*- */
// Copyright (C) 2003, 2004 by BiRC -- Bioinformatics Research Center
//                             University of Aarhus, Denmark
//                             Contact: Thomas Mailund <mailund@birc.dk>

#include <cassert>

using namespace std;

#include "unrootedtree.hh"
#include "rootedtree.hh"
#include "S.hh"

SMap smap;

UnrootedTree *
check_basic_tree()
{
    S *s1 = smap.Create("foo");
    S *s2 = smap.Create("bar");
    S *s3 = smap.Create("baz");
    S *s4 = smap.Create("qux");
  
    UnrootedTreeLeaf *l1, *l2, *l3, *l4;
    UnrootedTreeInner *i1, *i2;
  
    l1 = new UnrootedTreeLeaf(s1);
    l2 = new UnrootedTreeLeaf(s2);
    l3 = new UnrootedTreeLeaf(s3);
    l4 = new UnrootedTreeLeaf(s4);
  
    i1 = new UnrootedTreeInner();
    i2 = new UnrootedTreeInner();
  
    i1->connect(l1);
    i1->connect(l2);
    i1->connect(i2);
    i2->connect(l3);
    i2->connect(l4);
  
    assert(l1->neighbour() == i1);
    assert(l2->neighbour() == i1);
    assert(l3->neighbour() == i2);
    assert(l4->neighbour() == i2);
  
    //should probably be a leaf - like l1 is
    UnrootedTree *ut = new UnrootedTree(l1);
    
    return ut;
}

int
main()
{
    UnrootedTree *ut = check_basic_tree();
    RootedTree *rt = new RootedTree(ut, "foo");
    
    //since there is a root now
    assert(rt->leafs().size() == 3);
    assert(rt->nodes().size() == 6);
    //    std::cout << *rt << std::endl;

    return 0;
}
